package com.isoft.hospital.service.impl;

import com.isoft.hospital.common.ResponseData;
import com.isoft.hospital.dao.LoginDao;
import com.isoft.hospital.entity.Login;
import com.isoft.hospital.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service
public class LoginServiceImpl implements LoginService {
    @Autowired
    private LoginDao dao;
    @Override
    public ResponseData login(Login login) {
        ResponseData rd=new ResponseData();
        Login login1=dao.login(login);

        if(login1!=null){
            List<Login> list=new ArrayList<>();
            list.add(login1);
            rd.setCode(1);
            rd.setMsg("登陆成功");
            rd.setData(list);
        }else {
            rd.setCode(0);
            rd.setMsg("登录失败，账号或者密码不正确");

        }
        return rd;
    }
}
